﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SNAIL.Classes
{
    [Serializable()]
    public class ContactMessages
    {
        private DateTime _LastMessage = new DateTime();

        public DateTime LastMessage
        {
            get { return _LastMessage; }
            set { _LastMessage = value; }
        }

        private DateTime _LastMessageSent = new DateTime();

        public DateTime LastMessageSent
        {
            get { return _LastMessageSent; }
            set { _LastMessageSent = value; }
        }

        private DateTime _LastMessageReceived = new DateTime();

        public DateTime LastMessageReceived
        {
            get { return _LastMessageReceived; }
            set { _LastMessageReceived = value; }
        }

        private List<ContactMessage> _FromMessages = new List<ContactMessage>();

        public List<ContactMessage> FromMessages
        {
            get { return _FromMessages; }
            set { _FromMessages = value; }
        }
        private List<ContactMessage> _ToMessages = new List<ContactMessage>();

        public List<ContactMessage> ToMessages
        {
            get { return _ToMessages; }
            set { _ToMessages = value; }
        }
        public ContactMessages()
        {
            _FromMessages = new List<ContactMessage>();
            _ToMessages = new List<ContactMessage>();
        }

        public ContactMessages(List<ContactMessage> FromMessages, List<ContactMessage> ToMessages)
        {
            _FromMessages = FromMessages;
            _ToMessages = ToMessages;
        }
    }

    [Serializable()]
    public class ContactMessage
    {
        public ContactMessage(string EntryID, DateTime MailDate)
        {
            this._EntryID = EntryID;
            this._MailDate = MailDate;
        }

        public ContactMessage(string EntryID)
        {
            this._EntryID = EntryID;
        }

        public override bool Equals(object obj)
        {
            if (obj.GetType().Equals(typeof(ContactMessage)))
            {
                ContactMessage TempMessage = (ContactMessage)obj;
                if (TempMessage.EntryID == this.EntryID)
                {
                    return true;
                }
            }

            return false;
        }

        public override int GetHashCode()
        {
            return this.EntryID.GetHashCode();
        }

        private string _EntryID;

        public string EntryID
        {
            get { return _EntryID; }
            set { _EntryID = value; }
        }
        private DateTime _MailDate;

        public DateTime MailDate
        {
            get { return _MailDate; }
            set { _MailDate = value; }
        }
    }
}
